<style>
	.fpTable,.fpTable2{
		width:100%;
	}

.fpTable,.fpTable2{
	border-collapse:collapse;
	border:none;
}
.fpTable th,.fpTable2 th{
	background-color: #E0ECFF;
}

.fpTable td,.fpTable th{
	border:solid #DCDCDC 1px;
}
.fpTable2 td,.fpTable2 th{
	border:solid #DCDCDC 1px;
	padding-left: 4px;
}

	.fpTable2 tr{
		height:26px;
	}
	.fp_title{
		font-size: 22px;
		text-align: center;
		padding: 15px 0 10px 0;
	}
	.fp_title span{
		color:#0E2D5F;
		font-size: 22px;
		font-weight:bold;
	}
</style>
<div class="fp_title">为<span>{$group_data['title']}</span>分配权限</div>
<form id="fp_form" action="__APP__/Admin/Rule/rule_group" method="post">
<input  id="selectid" type="hidden" name="id" value="{$group_data['id']}">
    <table class="fpTable" cellspacing="0">
	
        <foreach name="rule_data" item="v">
            <empty name="v['_data']">
                <tr class="b-group">
                    <th width="10%"><label>{$v['text']} <input type="checkbox" name="rule_ids[]" value="{$v['id']}"
                        <if condition="in_array($v['id'],$group_data['rules'])"> checked="checked"</if>
                        onclick="checkAll(this)" ></label></th>
                    <td></td>
                </tr>
                <else/>
                <tr class="b-group">
                    <th width="10%"><label>{$v['text']} <input type="checkbox" name="rule_ids[]" value="{$v['id']}"
                        <if condition="in_array($v['id'],$group_data['rules'])"> checked="checked"</if>
                        onclick="checkAll(this)"></label></th>
                    <td class="b-child">
                        <foreach name="v['_data']" item="n">
                            <table class="fpTable2" cellspacing="0">
                                <tr class="b-group">
                                    <th style="width:90px;text-align:left;"><label>{$n['text']} <input type="checkbox" name="rule_ids[]"
                                                                                value="{$n['id']}"
                                        <if condition="in_array($n['id'],$group_data['rules'])"> checked="checked"</if>
                                        onclick="checkAll(this)"></label></th>
                                    <td width="">
                                        <notempty name="n['_data']">
                                            <volist name="n['_data']" id="c">
        <if condition="$c['leixing']!=3">
        <!-- 去除所有数据权限 -->
   <label>&emsp;{$c['text']} <input
                                                    type="checkbox" name="rule_ids[]" value="{$c['id']}"
                                                <if condition="in_array($c['id'],$group_data['rules'])">
                                                    checked="checked"
                                                </if>
                                                ></label>

        </if>
                                         

                                                </volist>
                                        </notempty>
                                    </td>
                                </tr>
                            </table>
                        </foreach>
                    </td>
                </tr>
            </empty>
        </foreach>
        <tr>
            <th></th>
            <td style="text-align:center;padding:10px;"><!-- <input class="easyui-linkbutton" data-options="iconCls:'icon-ok'" type="submit" value="提交"> -->
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-ok',size:'large'" onclick="submitForm()">提交</a>
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-ok',size:'large'" onclick="goback()">返回</a>
            </td>
        </tr>
    </table>
</form>
<script>
// 点击前面的checked全选
    function checkAll(obj) {
        $(obj).parents('.b-group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
    }
    function submitForm(){
 
    $('#fp_form').form('submit', {
    type:'POST',
     url : '__APP__/Admin/Rule/fpRule',
    success : function(data) {
      var data = eval('(' + data + ')');
      $.messager.alert('分配用户组', data.data, 'info');
    }
});
    }
  // 返回
 function goback(){
 	   // 获取当前tab
    var tab = $('#tab').tabs('getSelected'); 

    //跟新当前tab
    tab.panel('refresh', '__APP__/Admin/Rule/group');
    // var id =$('#selectid').val();
    // $('#grouplist').datagrid('selectRecord',1); 
 } 



</script>